<?php 
session_start();

$video = md5($_SESSION['Repositorio']['id'].$_SESSION['Repositorio']['dathor']).'.mp4';
//$video = 'd955ac01f55a53ce703026613468ab63.mp4';
$video = $_SESSION['Repositorio']['caminho'].$video;

if(file_exists($video)){
	header("Content-Type: video/x-flv");
	//header("Content-Type: video/mp4");
	header("Accept-Ranges: bytes");
	header("Content-Length: ".filesize($video));
	header("Cache-Control: no-cache, must-revalidate");// HTTP/1.1
	header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");// Date in the past  
	readfile($video);
	//unset($_SESSION['Repositorio']);
}else{
    header("HTTP/1.0 404 Not Found");
}
?>
